<template>
  <div>
    <div style="margin: 15px">
      <el-breadcrumb>
        <el-breadcrumb-item>首页</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="box">
      <div class="left">
        <div class="left_harder">产品添加中心</div>
        <div>
          <el-tree :data="data" :props="defaultProps" default-expand-all :render-content="renderContent"></el-tree>
        </div>
      </div>
      <div class="context">
        <div class="context_button">
          <el-button icon="el-icon-search" size="mini" type="warning">增加类型</el-button>
          <el-button icon="el-icon-search" size="mini" type="danger">删除类型</el-button>
        </div>
        <div class="input">
          <span>*分类:</span>
          <el-input v-model="input" placeholder="请输入内容"></el-input>
        </div>
        <div class="input">
          <span>*排序:</span>
          <el-input v-model="input_one" placeholder="请输入内容"></el-input>
        </div>
        <div class="input_one">
          <span>*备注:</span>
          <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 4 }" placeholder="请输入内容" v-model="textarea2"> </el-input>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      input: '',
      input_one: '',
      textarea2: '',
      data: [
        {
          label: '一级 1',
          menuName: '系统管理',
          icon: 'el-icon-folder-opened',

          children: [
            {
              label: '二级 1-1',
              menuName: '系统管理',
              icon: 'el-icon-folder-opened',
              children: [
                {
                  label: '三级 1-1-1',
                  menuName: '系统管理',
                  icon: 'el-icon-folder-opened',
                },
              ],
            },
          ],
        },
        {
          label: '一级 2',
          menuName: '系统管理',
          icon: 'el-icon-folder-opened',
          children: [
            {
              label: '二级 2-1',
              menuName: '系统管理',
              icon: 'el-icon-folder-opened',
              children: [
                {
                  label: '三级 2-1-1',
                  menuName: '系统管理',
                  icon: 'el-icon-folder-opened',
                },
              ],
            },
            {
              label: '二级 2-2',
              menuName: '系统管理',
              icon: 'el-icon-folder-opened',
              children: [
                {
                  label: '三级 2-2-1',
                  menuName: '系统管理',
                  icon: 'el-icon-folder-opened',
                },
              ],
            },
          ],
        },
        {
          label: '一级 3',
          menuName: '系统管理',
          icon: 'el-icon-folder-opened',
          children: [
            {
              label: '二级 3-1',
              menuName: '系统管理',
              icon: 'el-icon-folder-opened',
              children: [
                {
                  label: '三级 3-1-1',
                  menuName: '系统管理',
                  icon: 'el-icon-folder-opened',
                },
              ],
            },
            {
              label: '二级 3-2',
              menuName: '系统管理',
              icon: 'el-icon-folder-opened',
              children: [
                {
                  label: '三级 3-2-1',
                  menuName: '系统管理',
                  icon: 'el-icon-folder-opened',
                },
              ],
            },
          ],
        },
      ],
      defaultProps: {
        children: 'children',
        label: 'label',
      },
    }
  },
  methods: {
    handleSelectionChange(val) {
      //获取每一行内的每一项的属性
      this.multipleSelection = val
      console.log(
        val.map((item) => {
          console.log(item.id)
        })
      )
    },
    renderContent: function (h, { node, data, store }) {
      //树状图
      return (
        <span>
          <i class={data.icon}></i>
          <span style="padding-left: 4px;">{node.label}</span>
        </span>
      )
    },
  },
}
</script>

<style lang="scss" scoped>
::v-deep .el-input__inner {
  width: 200px;
  height: 30px;
}

::v-deep .el-input {
  width: 200px;
  height: 30px;
}
::v-deep .el-textarea__inner {
  width: 300px;
}
::v-deep .el-textarea {
  width: 300px;
}
.box {
  width: 100%;

  display: flex;
}

.left {
  width: 20%;

  .left_harder {
    padding: 5px;
    color: white;
    background-color: #61a7cf;
  }
}

.context {
  width: 80%;
  height: auto;
  padding: 0 0 0 100px;
  // border: 1px red solid;

  .context_button {
    width: 300px;
    display: flex;
    justify-content: space-around;
    margin: 10px 0 20px 0px;
  }

  .input {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    width: 400px;
    margin: 0 0 10px 0;
  }
  .input_one {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    width: 500px;
  }
}
</style>
